/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author santiagobaldrich
 */
@Entity
@Table(name = "Run")
@NamedQueries(
{
    @NamedQuery(name = "Run.findAll", query = "SELECT r FROM Run r"),
    @NamedQuery(name = "Run.findByIdRun", query = "SELECT r FROM Run r WHERE r.idRun = :idRun"),
    @NamedQuery(name = "Run.findByVerdict", query = "SELECT r FROM Run r WHERE r.verdict = :verdict"),
    @NamedQuery(name = "Run.findByTime", query = "SELECT r FROM Run r WHERE r.time = :time")
})
public class Run implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idRun")
    private Integer idRun;
    @Basic(optional = false)
    @Column(name = "verdict")
    private String verdict;
    @Lob
    @Column(name = "output")
    private String output;
    @Basic(optional = false)
    @Column(name = "time")
    private int time;
    @JoinColumn(name = "idTestCase", referencedColumnName = "idTestCase")
    @ManyToOne(optional = false)
    private TestCase testCase;
    @JoinColumn(name = "idSubmission", referencedColumnName = "idSubmission")
    @ManyToOne(optional = false)
    private Submission submission;

    public Run()
    {
    }

    public Run(Integer idRun)
    {
        this.idRun = idRun;
    }

    public Run(Integer idRun, String verdict, int time)
    {
        this.idRun = idRun;
        this.verdict = verdict;
        this.time = time;
    }

    public Integer getIdRun()
    {
        return idRun;
    }

    public void setIdRun(Integer idRun)
    {
        this.idRun = idRun;
    }

    public String getVerdict()
    {
        return verdict;
    }

    public void setVerdict(String verdict)
    {
        this.verdict = verdict;
    }

    public String getOutput()
    {
        return output;
    }

    public void setOutput(String output)
    {
        this.output = output;
    }

    public int getTime()
    {
        return time;
    }

    public void setTime(int time)
    {
        this.time = time;
    }

    public TestCase getTestCase()
    {
        return testCase;
    }

    public void setTestCase(TestCase testCase)
    {
        this.testCase = testCase;
    }

    public Submission getSubmission()
    {
        return submission;
    }

    public void setSubmission(Submission submission)
    {
        this.submission = submission;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (idRun != null ? idRun.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Run))
        {
            return false;
        }
        Run other = (Run) object;
        if ((this.idRun == null && other.idRun != null) || (this.idRun != null && !this.idRun.equals(other.idRun)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "entities.Run[idRun=" + idRun + "]";
    }

}
